/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Actor.weapons;

import Actor.Actor;
import javax.vecmath.Point2d;

/**
 *
 * @author Eric-Standard
 */
public class Semtex extends Grenade {

    private boolean stuck = false;
    private Point2d actorPoint;
    private Point2d translatedPoint;

    @Override
    public void act(long dt) {
        super.act(dt);
        if (stuck) {
            this.pos.add(actorPoint, translatedPoint);
        }
    }

    @Override
    public void collide(Actor a) {
        if (a != owner) {
            if (!stuck) {
                actorPoint = a.getPos();
                translatedPoint = new Point2d();
                translatedPoint.sub(pos, actorPoint);
                stuck = true;
                vel.x = vel.y = 0;
            }
        }
    }
}
